PATH
Rhapsody Developer Release Copyright 1997 Apple
Computer, Inc. All Rights Reserved.
Inherits From: NSObject
Conforms To: NSCoding, NSCopying
Declared In: Interceptor/NSDirectPalette.h
An NSDirectPalette provides a representation of the color palette of the display when a system is running in 8-bit pseudocolor mode. The NSDirectPalette object is used in programs that take over the entire display from the Window Server, using the NSDirectScreen object to reconfigure the display.
The NSDirectPalette caches and vends machine-specific palette data as an NSData object through the rawMachinePalette method. The contents and layout of this NSData object will change across different platforms and versions of the NSDirectPalette and NSDirectScreen objects. The rawMachinePalette method is intended for use primarily by NSDirectScreen objects in the initial release.
Manipulation of an NSDirectPalette instance does not affect the hardware display. The palette must be explicitly sent to a NSDirectScreen instance in a setPalette: or setPaletteAtNextBlankingInterval: message in order to affect a hardware display.
+ (NSDirectPalette *)defaultPalette
Returns a default palette. The contents of the palette are platform-specific.
- (NSDirectPalette *)blendedPaletteWithFraction:(float)fraction ofColor:(NSColor *)color
Returns a palette whose colors are a blend of the colors in this palette and the color parameter. Each color in the current palette is blended with the color represented by the color object, and entered in the returned palette. The degree of blending is controlled by thefraction value. A fraction of 0.0 results in a copy of the current palette, while a fraction of 1.0 results in a palette with all entries consisting of color .
- (NSColor *)colorAtIndex:(int)index
Returns the NSColor object stored at index in the palette.
- (unsigned)count
Returns the number of colors used in this palette.
- (void)getRed:(float *)pRed green:(float *)pGreen blue:(float *)pBlue atIndex:(float *)idex
Returns the red, green, and blue color values for the NSColor object stored at index in the palette.
- (int)indexForColor:(NSColor *)color
Returns the palette index that best represents color. Gray values are preferentially matched to indices for gray values in the palette.
- (NSDirectPalette *)init
Initializes a default palette. The contents of the palette are platform-specific.
- (NSDirectPalette *)initWithArrayOfColors:(NSArray *)colors
Initializes a palette with the NSColor objects stored in the array . Ordering in the palette matches ordering in the array.
- (NSEnumerator *)objectEnumerator
Returns an enumerator object that lets you access each NSColor in the palette, starting with the first element.
NSEnumerator *enumerator = [myPalette objectEnumerator]; NSColor * aColor; while (aColor = [enumerator nextObject]) { /* code to act on each color as it is returned */ }
Your code shouldn't modify the palette during enumeration.
See also: - nextObject (NSEnumerator)
- (NSData *)rawMachinePalette
Caches and vends machine-specific palette data, returned as an NSData object. The contents and layout of this NSData object differs between different platforms and versions of the NSDirectPalette and NSDirectScreen objects. The rawMachinePalette method is intended for use primarily by NSDirectScreen objects in the initial release.
- (void)setColor:(NSColor *)color atIndex:(int)index
Sets the color at index to be color . The previous color at index is released.
- (void)setColors:(NSColor **)colors atIndices:(NSRange)indexRange
Sets the colors over the range specified by indexRange from colors . The previous colors in indexRange are released.
- (void)setRed:(float)red green:(float)green blue:(float)blue atIndex:(int)index
Set the color at index to be an NSColor object representing red , green , and blue . The previous color at index is released.